DIR_OBJ = ./obj
CC = gcc

DIR_INC = -I ./fun 
DIR_INC += -I ./ech

DIR_SRC_FUN = ./fun
DIR_SRC_ECH = ./ech
OBJS = $(DIR_OBJ)/fun.o $(DIR_OBJ)/ech.o $(DIR_OBJ)/prt.o $(DIR_OBJ)/main.o

all: $(OBJS)
	$(CC) $^ -o $(DIR_OBJ)/all

$(DIR_OBJ)/%.o: $(DIR_SRC_FUN)/%.c
	$(CC) -c $< -o $@ $(DIR_INC)

$(DIR_OBJ)/%.o: $(DIR_SRC_ECH)/%.c
	$(CC) -c $< -o $@ $(DIR_INC)	

$(DIR_OBJ)/main.o: ./main.c	
	$(CC) -c $< -o  $@ $(DIR_INC)

.PHONY:clean
clean:
	rm $(DIR_OBJ)/*.o $(DIR_OBJ)/all